package com.sgl.myview.business;

import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.sgl.myview.R;
import com.sgl.myview.view.CustomProgressBar;

public class CustomProgressBarActivity extends AppCompatActivity implements View.OnClickListener {
    private CustomProgressBar mProgressBar;
    private Button mAdd;
    private Button mReduce;


    public static Intent getInstance(Context mContext){
        return new Intent(mContext,CustomProgressBarActivity.class);
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_custom_progress_bar);
        mProgressBar = (CustomProgressBar) findViewById(R.id.pro);
        mAdd = (Button) findViewById(R.id.jia);
        mReduce = (Button) findViewById(R.id.jian);
        mAdd.setOnClickListener(this);
        mReduce.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.jia:
                mProgressBar.setSpeed(false);
                break;
            case R.id.jian:
                mProgressBar.setSpeed(true);
                break;
        }
    }
}
